import { Component, OnInit } from '@angular/core';
import { ToastController } from '@ionic/angular';
import { PRIMARY_OUTLET } from '@angular/router';

@Component({
  selector: 'app-cart',
  templateUrl: './cart.page.html',
  styleUrls: ['./cart.page.scss'],
})
export class CartPage implements OnInit {

  week_data: any
  month_data: any
  constructor(public toastController: ToastController) {
    this.week_data = [
      {
        //https://item.jd.com/100000009811.html
        img: "https://img11.360buyimg.com/n1/jfs/t30559/226/751774559/268885/2f9f70b2/5bfd040bN44137661.jpg",
        name: "儿童白色舞蹈袜子",
        price: 30.99,
        score: 4.8,
        stars: 5,
        index: 0,
      },
      {
        // https://item.jd.com/11691215480.html
        img: "https://img10.360buyimg.com/n1/jfs/t1/24959/4/10179/143996/5c83e5b5E47bc80f6/26a26604a7c86186.jpg",
        name: "婴儿内衣套装纯棉春秋",
        price: 59.00,
        score: 4.9,
        stars: 5,
        index: 1,
      },
      {
        //https://item.jd.com/40526501607.html
        img: "https://img12.360buyimg.com/n1/jfs/t1/21176/7/3530/218667/5c288387Ec65f4011/4acd494ac585daa4.jpg",
        name: "2018新款潮亲子全家装",
        price: 208.00,
        score: 4.8,
        stars: 5,
        index: 2,
      },
    ]

    this.month_data = [
      {
        // https://item.jd.com/21144823241.html
        img: "https://img11.360buyimg.com/n1/jfs/t16240/213/744372352/375324/628eb952/5a3cc850Nf9c4404a.jpg",
        name: "连帽休闲卫衣家庭装亲子",
        price: 198.00,
        score: 4.7,
        stars: 5,
        index: 3,
      },
      {
        // https://item.jd.com/19031093274.html
        img: "https://img14.360buyimg.com/n1/jfs/t10156/317/2460272034/419021/b64fdc1f/59f83451N1faaed3c.jpg",
        name: "2019新品潮母女装母子装",
        price: 58.00,
        score: 4.7,
        stars: 5,
        index: 4,
      },
      {
        // https://item.jd.com/30651952146.html#crumb-wrap
        img: "https://img11.360buyimg.com/n1/jfs/t1/23724/33/6280/169281/5c4ae04dEf1da8ba9/c4f4b3b48572e9cb.jpg",
        name: "童装女童套装加绒保暖",
        price: 99.00,
        score: 5.0,
        stars: 4,
        index: 5,
      }
    ]
  }

  ngOnInit() {
  }

  async deleteItem(index: Number) {
    console.log("删除" + index)
    const toast = await this.toastController.create({
      message: '删除成功',
      duration: 2000
    });

    toast.present();
  }

  async presentToastWithOptions() {
    const toast = await this.toastController.create({
      message: '删除成功',
      showCloseButton: true,
      color:"primary",
      position: 'bottom',
      duration: 1000,
      closeButtonText: '确定'
    });
    toast.present();
  }

}
